package com.freedom.supercoin.network;

public class Result<T> {
    private T data;
    private String success;
    private String code;
    private String msg;
    private int size;
    private T body;


    public Result(T data, String success, String errCode, String errMsg, int size) {
        this.data = data;
        this.success = success;
        this.code = errCode;
        this.msg = errMsg;
        this.size = size;
    }


    public T getBody() {
        return body;
    }


    public T getData() {
        return data;
    }


    public void setData(T data) {
        this.data = data;
    }


    public void setBody(T body) {
        this.body = body;
    }


    public String getSuccess() {
        return success;
    }


    public void setSuccess(String success) {
        this.success = success;
    }


    public String getErrCode() {
        return code;
    }


    public void setErrCode(String errCode) {
        this.code = errCode;
    }


    public String getErrMsg() {
        return msg;
    }


    public void setErrMsg(String errMsg) {
        this.msg = errMsg;
    }


    public int getSize() {
        return size;
    }


    public void setSize(int size) {
        this.size = size;
    }


    public ClientException checkResult() {
        if ("成功".equalsIgnoreCase(msg)) {
            return null;
        } else {
            return new ClientException(code, this.msg, null);
        }
    }

}
